module sva_ca_method;

    logic clk;
    initial begin
        clk = 0;
        forever #5 clk = ~clk;
    end

    int a;
    initial begin
        a = 91; #5;  // 5ns : $rose(a) passed,   $fell(a) failed,   $stable(a) failed,   $changed(a) passed,   $past(a, 2) 0 ,   $sampled(a) 91
        a = 80; #10; // 15ns: $rose(a) failed,   $fell(a) passed,   $stable(a) failed,   $changed(a) passed,   $past(a, 2) 0 ,   $sampled(a) 80
        a = 71; #10; // 25ns: $rose(a) passed,   $fell(a) failed,   $stable(a) failed,   $changed(a) passed,   $past(a, 2) 91,   $sampled(a) 71
        a = 51; #10; // 35ns: $rose(a) failed,   $fell(a) failed,   $stable(a) failed,   $changed(a) passed,   $past(a, 2) 80,   $sampled(a) 51
        a = 51; #10; // 45ns: $rose(a) failed,   $fell(a) failed,   $stable(a) passed,   $changed(a) failed,   $past(a, 2) 71,   $sampled(a) 51
        a = 40; #10; // 55ns: $fell(a) failed,   $fell(a) passed,   $stable(a) failed,   $changed(a) passed,   $past(a, 2) 51,   $sampled(a) 40
                #10;
        $finish;
    end

    property p1;
        @(posedge clk) $rose(a);
    endproperty
    ap1: assert property(p1) $info("$rose(a) passed"); else $error("$rose(a) failed");

    property p2;
        @(posedge clk) $fell(a);
    endproperty
    ap2: assert property(p2) $info("$fell(a) passed"); else $error("$fell(a) failed");

    property p3;
        @(posedge clk) $stable(a);
    endproperty
    ap3: assert property(p3) $info("$stable(a) passed"); else $error("$stable(a) failed");

    property p4;
        @(posedge clk) $changed(a);
    endproperty
    ap4: assert property(p4) $info("$changed(a) passed"); else $error("$changed(a) failed");

    property p5;
        @(posedge clk) $past(a, 2);
    endproperty
    ap5: assert property(p5) $info("$past(a, 2) ", $past(a, 2)); else $error("$past(a, 2) ", $past(a, 2));

    property p6;
        @(posedge clk) $sampled(a);
    endproperty
    ap6: assert property(p6) $info("$sampled(a) ", $sampled(a)); else $info("$sampled(a) ", $sampled(a));
    initial begin
        $dumpfile("dump.vcd"); $dumpvars;
    end
endmodule

/* Output: QuestaSim
# ** Info: $sampled(a)          91
#    Time: 5 ns Started: 5 ns  Scope: sva_ca_method.ap6 File: sva_ca_method.sv Line: 49
# ** Error: $past(a, 2)           0
#    Time: 5 ns Started: 5 ns  Scope: sva_ca_method.ap5 File: sva_ca_method.sv Line: 44
# ** Info: $changed(a) passed
#    Time: 5 ns Started: 5 ns  Scope: sva_ca_method.ap4 File: sva_ca_method.sv Line: 39
# ** Error: $stable(a) failed
#    Time: 5 ns Started: 5 ns  Scope: sva_ca_method.ap3 File: sva_ca_method.sv Line: 34
# ** Error: $fell(a) failed
#    Time: 5 ns Started: 5 ns  Scope: sva_ca_method.ap2 File: sva_ca_method.sv Line: 29
# ** Info: $rose(a) passed
#    Time: 5 ns Started: 5 ns  Scope: sva_ca_method.ap1 File: sva_ca_method.sv Line: 24
# ** Info: $sampled(a)          80
#    Time: 15 ns Started: 15 ns  Scope: sva_ca_method.ap6 File: sva_ca_method.sv Line: 49
# ** Error: $past(a, 2)           0
#    Time: 15 ns Started: 15 ns  Scope: sva_ca_method.ap5 File: sva_ca_method.sv Line: 44
# ** Info: $changed(a) passed
#    Time: 15 ns Started: 15 ns  Scope: sva_ca_method.ap4 File: sva_ca_method.sv Line: 39
# ** Error: $stable(a) failed
#    Time: 15 ns Started: 15 ns  Scope: sva_ca_method.ap3 File: sva_ca_method.sv Line: 34
# ** Info: $fell(a) passed
#    Time: 15 ns Started: 15 ns  Scope: sva_ca_method.ap2 File: sva_ca_method.sv Line: 29
# ** Error: $rose(a) failed
#    Time: 15 ns Started: 15 ns  Scope: sva_ca_method.ap1 File: sva_ca_method.sv Line: 24
# ** Info: $sampled(a)          71
#    Time: 25 ns Started: 25 ns  Scope: sva_ca_method.ap6 File: sva_ca_method.sv Line: 49
# ** Info: $past(a, 2)          91
#    Time: 25 ns Started: 25 ns  Scope: sva_ca_method.ap5 File: sva_ca_method.sv Line: 44
# ** Info: $changed(a) passed
#    Time: 25 ns Started: 25 ns  Scope: sva_ca_method.ap4 File: sva_ca_method.sv Line: 39
# ** Error: $stable(a) failed
#    Time: 25 ns Started: 25 ns  Scope: sva_ca_method.ap3 File: sva_ca_method.sv Line: 34
# ** Error: $fell(a) failed
#    Time: 25 ns Started: 25 ns  Scope: sva_ca_method.ap2 File: sva_ca_method.sv Line: 29
# ** Info: $rose(a) passed
#    Time: 25 ns Started: 25 ns  Scope: sva_ca_method.ap1 File: sva_ca_method.sv Line: 24
# ** Info: $sampled(a)          51
#    Time: 35 ns Started: 35 ns  Scope: sva_ca_method.ap6 File: sva_ca_method.sv Line: 49
# ** Info: $past(a, 2)          80
#    Time: 35 ns Started: 35 ns  Scope: sva_ca_method.ap5 File: sva_ca_method.sv Line: 44
# ** Info: $changed(a) passed
#    Time: 35 ns Started: 35 ns  Scope: sva_ca_method.ap4 File: sva_ca_method.sv Line: 39
# ** Error: $stable(a) failed
#    Time: 35 ns Started: 35 ns  Scope: sva_ca_method.ap3 File: sva_ca_method.sv Line: 34
# ** Error: $fell(a) failed
#    Time: 35 ns Started: 35 ns  Scope: sva_ca_method.ap2 File: sva_ca_method.sv Line: 29
# ** Error: $rose(a) failed
#    Time: 35 ns Started: 35 ns  Scope: sva_ca_method.ap1 File: sva_ca_method.sv Line: 24
# ** Info: $sampled(a)          51
#    Time: 45 ns Started: 45 ns  Scope: sva_ca_method.ap6 File: sva_ca_method.sv Line: 49
# ** Info: $past(a, 2)          71
#    Time: 45 ns Started: 45 ns  Scope: sva_ca_method.ap5 File: sva_ca_method.sv Line: 44
# ** Error: $changed(a) failed
#    Time: 45 ns Started: 45 ns  Scope: sva_ca_method.ap4 File: sva_ca_method.sv Line: 39
# ** Info: $stable(a) passed
#    Time: 45 ns Started: 45 ns  Scope: sva_ca_method.ap3 File: sva_ca_method.sv Line: 34
# ** Error: $fell(a) failed
#    Time: 45 ns Started: 45 ns  Scope: sva_ca_method.ap2 File: sva_ca_method.sv Line: 29
# ** Error: $rose(a) failed
#    Time: 45 ns Started: 45 ns  Scope: sva_ca_method.ap1 File: sva_ca_method.sv Line: 24
# ** Info: $sampled(a)          40
#    Time: 55 ns Started: 55 ns  Scope: sva_ca_method.ap6 File: sva_ca_method.sv Line: 49
# ** Info: $past(a, 2)          51
#    Time: 55 ns Started: 55 ns  Scope: sva_ca_method.ap5 File: sva_ca_method.sv Line: 44
# ** Info: $changed(a) passed
#    Time: 55 ns Started: 55 ns  Scope: sva_ca_method.ap4 File: sva_ca_method.sv Line: 39
# ** Error: $stable(a) failed
#    Time: 55 ns Started: 55 ns  Scope: sva_ca_method.ap3 File: sva_ca_method.sv Line: 34
# ** Info: $fell(a) passed
#    Time: 55 ns Started: 55 ns  Scope: sva_ca_method.ap2 File: sva_ca_method.sv Line: 29
# ** Error: $rose(a) failed
#    Time: 55 ns Started: 55 ns  Scope: sva_ca_method.ap1 File: sva_ca_method.sv Line: 24
 */
